package com.qf.mybatisplus.controller.rabbitMQ;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/phone")
    public String phoneCode(String phone){
//        rabbitTemplate.send("phoneQueue", phone);
        for (int i = 0; i < 10; i++) {
            rabbitTemplate.convertAndSend("phoneQueue",phone);
        }

        System.err.println(phone);

        return "发送成功";
    }

}
